# coding: utf-8

from export.utils import *


def orders_1(sql):
    # 替换为当前月份分区表
    this_month_format = datetime.datetime.now().strftime('%Y_%#m')
    first_day = datetime.datetime.now().strftime('%#d')
    if first_day == '1':
        sql = sql.replace('2021_1', get_prev_month())
    else:
        sql = sql.replace('2021_1', this_month_format)

    return sql


def orders_2(sql):
    pass


def orders_3(sql):
    pass


def orders_4(sql):
    pass

    
if __name__ == '__main__':
    s = "select * from test_2021_1"
    print(orders_1(s))
